package kr.hkit.androidcomplete02.ch16;

import kr.hkit.androidcomplete02.R;
import kr.hkit.androidcomplete02.R.drawable;
import kr.hkit.androidcomplete02.R.layout;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

public class AlertDialogEx extends Activity {
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch16_dialogex);
	}

	public void mOnClick(View v) {
		new AlertDialog.Builder(this).setTitle("알립니다")
				.setIcon(R.drawable.ic_launcher).setMessage("대화상자를 열었습니다")
				.setPositiveButton("확인", new OnClickListener() {
					public void onClick(DialogInterface dialog, int which) {	
						Toast.makeText(AlertDialogEx.this, "확인" + which, Toast.LENGTH_SHORT).show();
					}
				})
				.setNegativeButton("취소", new OnClickListener() {
					public void onClick(DialogInterface dialog, int which) {
						Toast.makeText(AlertDialogEx.this, "취소" + which, Toast.LENGTH_SHORT).show();
					}
				})
				.setNeutralButton("중지", new OnClickListener() {
					public void onClick(DialogInterface dialog, int which) {
						Toast.makeText(AlertDialogEx.this, "중지" + which, Toast.LENGTH_SHORT).show();
					}
				})
				.setCancelable(false)
				.show();
	}
}
